<?php defined('IN_IA') or exit('Access Denied');?><?php include page("header-base");?>

<?php  if($operation=='display') { ?>

<div class="panel">
     <h3 class="custom_page_header"> 会员消息</h3>
        
    <div class="panel-body">
        <form action="./index.php" id="form_id" method="get" class="form-horizontal" role="form" id="form1">
            <input type="hidden" name="mod" value="site" />
            <input type="hidden" name="m" value="eshop" />
            <input type="hidden" name="do" value="member" />
              <input type="hidden" name="act" value="reservation" />
              
            <div class="form-group">
       
                
                  <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">会员信息</label>
                <div class="col-sm-3 col-lg-3 col-xs-2">
                    <input type="text" class="form-control"  name="realname" value="<?php  echo $_GPC['realname'];?>" placeholder="可搜索昵称/姓名/手机号/会员ID"/> 
                </div>
                
                    <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">黑名单</label>
                <div class="col-sm-3 col-lg-3 col-xs-2">
                    <select name='isblack' class='form-control'>
                        <option value=''></option>
                        <option value='0' <?php  if($_GPC['isblack']=='0') { ?>selected<?php  } ?>>否</option>
                        <option value='1' <?php  if($_GPC['isblack']=='1') { ?>selected<?php  } ?>>是</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                
                <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">排序方式</label>
                <div class="col-sm-3 col-lg-3 col-xs-2">
                    <select name='order' id='select-id' class='form-control'>
                        <option value='getto|desc' <?php if($order_type == 'getto_date' and $order_by == 'desc') echo "selected = 'selected'";?>>接机时间顺序</option>
                        <option value='getto|asc' <?php if($order_type == 'getto_date' and $order_by == 'asc') echo "selected = 'selected'";?>>接机时间逆序</option>
                        <option value='setoff|desc' <?php if($order_type == 'setoff_date' and $order_by == 'desc') echo "selected = 'selected'";?>>送机时间顺序</option>
                        <option value='setoff|asc' <?php if($order_type == 'setoff_date' and $order_by == 'asc') echo "selected = 'selected'";?>>送机时间逆序</option>
                    </select>
                    <input type='hidden' id='order-type' name='order-type' value='<?php echo $_GPC['order-type'];?>'>
                    <input type='hidden' id='order-by' name='order-by' value='<?php echo $_GPC['order-by'];?>'>
                </div>
                <script>
                    $('#select-id').change(function(){
                        var arr = $(this).val().split('|');
                        $('#order-type').val(arr[0]);
                        $('#order-by').val(arr[1]);
                        $('#form_id').submit();
                    });
                </script>
                
                 <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">预约地区</label>
                <div class="col-sm-3 col-lg-3 col-xs-2">
                    <select name='reserve-area' class='form-control'>
                        <option value=''></option>
                        <option value='首尔' <?php  if($_GPC['reserve-area']=='首尔') { ?>selected<?php  } ?>>首尔</option>
                        <option value='济州' <?php  if($_GPC['reserve-area']=='济州') { ?>selected<?php  } ?>>济州</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                    <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">选择时间段</label>
                    
                    <div class="col-sm-5">
                    <div class='input-group'>
                        <div class='input-group-addon'>
                            <label class='radio-inline' style='margin-top:-7px;'>
                                <input type='radio' value='0' name='searchtime' <?php  if(empty($_GPC['searchtime'])) { ?>checked<?php  } ?>>不选择
                            </label>
                            <label class='radio-inline'  style='margin-top:-7px;'>
                                <input type='radio' value='1' name='searchtime' <?php  if($_GPC['searchtime']=='1') { ?>checked<?php  } ?>>选择
                            </label>
                        </div>
                           <?php  echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d', $starttime),'endtime'=>date('Y-m-d', $endtime)),false);?>
                   
                     </div>
                       
                    </div>
                         
                </div>
             
            
                <div class="form-group">
                    <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    
                     <div class="col-sm-4 col-lg-4 col-xs-4">
                       <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                       <input type="hidden" name="token" value="<?php  echo $_W['token'];?>" />
                       <button type="submit" name="export" value="1" class="btn btn-primary">导出 接机预约表</button>
                       <button type="submit" name="export" value="2" class="btn btn-primary">导出 送机预约表</button>
                    </div>
                        
                </div>
         
            
       
        </form>
        <table class="table table-hover" style="overflow:visible;">
            <thead class="navbar-inner">
                <tr>

                    <th style='width:60px;'>编号</th>
                    <th >姓名</th>
                    <th style='width:60px;'>区域</th>
                    <th >接机时间</th>
                    <th >接机航班号</th>
                    <th >送机时间</th>
                    <th >送机航班号</th>
                    <th >航班起飞时间</th>
                    <th >酒店</th>
                    <th style='width:60px;'>人数</th>
                    <th style='width:60px;'>行李数</th>
                    <th >状态</th>
                    <th >操作</th>
                </tr>
            </thead>
            <tbody>
                <?php  if(is_array($list)) { foreach($list as $row) { ?>
                <tr>
                    <td><?php  echo $row['count']?></td>
                    <td><?php  echo $row['realname'];?></td>
                    <td><?php  echo $row['reserve_area'];?></td>
                    <td><?php  echo $row['getto_date'];?></td>
                    <td><?php  echo $row['getto_flight']?></td>
                    <td><?php  echo $row['songji_time'];?></td>
                    <td><?php  echo $row['setoff_flight']?></td>
                    <td><?php  echo $row['setoff_date'];?></td>
                    <td><?php  echo $row['hotel']?></td>
                    <td><?php  echo $row['people_num']?></td>
                    <td><?php  echo $row['packet_num']?></td>
                    <td><?php if($row['isread'] == 0) echo '<label class="label label-danger">未审阅</label>';else echo '<label class="label label-primary">已审阅</label>';?></td>
             
                            <td  style="overflow:visible;">
                        
                        <div class="btn-group btn-group-sm" >
                                <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                                <ul class="dropdown-menu dropdown-menu-left" role="menu" style='z-index: 9999'>
                               
                        <li><a href="<?php  echo $this->createWebUrl('member/list',array('op'=>'detail','id' => $row['id']));?>" target="_blank" title="会员详情"><i class='fa fa-edit'></i> 会员详情</a></li>
                        <li><a href="<?php  echo $this->createWebUrl('member/reservation',array('op'=>'detail','id' => $row['id'],'reserve_id' => $row['reserve_id']));?>" title="预约详情"><i class='fa fa-list'></i> 预约详情</a></li>
                        <li><a onclick="return confirm('信息删除后不可恢复，确认删除？')" href="<?php  echo $this->createWebUrl('member/reservation',array('op'=>'delete','id' => $row['id'],'reserve_id' => $row['reserve_id']));?>" title="删除预约"><i class='fa fa-remove'></i> 删除预约</a></li>
                                </ul>
                            </div>
                    </td>
                   
                </tr>
                <?php  } } ?>
            </tbody>
        </table>
           <?php  echo $pager;?>
    </div>
</div>
<?php  } else if($operation=='detail') { ?>

<form action="" method='post' class='form-horizontal'>
    <input type="hidden" name="id" value="<?php  echo $member['id'];?>">
    <input type="hidden" name="reserve_id" value="<?php  echo $row['id'];?>">
    <div class='panel panel-default'>
         <h3 class="custom_page_header">
            预约详细信息
        </h3>
        <div class='panel-body'>
             <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝</label>
                <div class="col-sm-9 col-xs-12">
                    <img src='<?php  echo $member['avatar'];?>' onerror="this.src='<?php  echo RESOURCE_ROOT;?>eshop/mobile/default/static/images/tx.png'" style='width:100px;height:100px;padding:1px;border:1px solid #ccc' />
                         <?php  echo $member['nickname'];?>
                </div>
            </div>
               <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">OPENID</label>
                <div class="col-sm-9 col-xs-12">
                    <div class="form-control-static"><?php  echo $member['openid'];?></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[realname]" class="form-control" value="<?php  echo $row['realname'];?>"  />
                
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">申请时间</label>
                <div class="col-sm-9 col-xs-12">
                    <div class='form-control-static'><?php  echo $row['reserve_time'];?></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">预约区域</label>
                <div class="col-sm-9 col-xs-12">
                    <label class="radio-inline"><input type="radio" name="data[reserve_area]" value="首尔" <?php  if($row['reserve_area']=='首尔') { ?>checked<?php  } ?>>首尔</label>
                    <label class="radio-inline" ><input type="radio" name="data[reserve_area]" value="济州" <?php  if($row['reserve_area']=='济州') { ?>checked<?php  } ?>>济州</label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">此行人数</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[people_num]" class="form-control" value="<?php  echo $row['people_num'];?>"  />
                
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">微信二维码</label>
                <div class="col-sm-9 col-xs-12">
                    <img src="<?php  echo $row['wechat_image'];?>" style="max-width: 400px;max-height: 400px;" alt="">
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">接机时间</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="datetime-local" name="data[getto_date]" class="form-control" value="<?php  echo join('T',explode(' ', $row['getto_date']));?>"  />
                
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">接机航班号</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[getto_flight]" class="form-control" value="<?php  echo $row['getto_flight'];?>"  />
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">送机时间</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[songji_time]" class="form-control" value="<?php  echo join('T',explode(' ', $row['songji_time']));?>"  />
                
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">送机航班号</label>
                <div class="col-sm-9 col-xs-12">
                    
                    <input type="text" name="data[setoff_flight]" class="form-control" value="<?php  echo $row['setoff_flight'];?>"  />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">航班起飞时间</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="datetime-local" name="data[setoff_date]" class="form-control" value="<?php  echo join('T',explode(' ', $row['setoff_date']));?>"  />
                
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">行李数</label>
                <div class="col-sm-9 col-xs-12">
                    
                    <input type="text" name="data[packet_num]" class="form-control" value="<?php  echo $row['packet_num'];?>"  />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">入住酒店</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[hotel]" class="form-control" value="<?php  echo $row['hotel'];?>"  />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">酒店地址信息</label>
                <div class="col-sm-9 col-xs-12">
                    <img src="<?php  echo $row['hotel_image'];?>" style="max-width: 400px;max-height: 400px;" alt="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">备注</label>
                <div class="col-sm-9 col-xs-12">
                    <textarea name="data[remark]" class='form-control'><?php  echo $row['remark'];?></textarea>
                </div>
            </div>
        </div>
               
        <div class='panel-body'>
          <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                <div class="col-sm-9 col-xs-12">
                    <input type="submit" name="submit" value="提交" class="btn btn-primary" />
                    <?php
                    if($row['isread'] == 0)
                        echo '<input type="submit" name="mark" value="标记已处理" class="btn btn-primary" />';
                    else
                        echo '<input type="submit" name="dismark" value="标记未处理" class="btn btn-warning" />';
                    ?>
                    <a onclick="return confirm('信息删除后不可恢复，确认删除？')" href="<?php  echo $this->createWebUrl('member/reservation',array('op'=>'delete','reserve_id' => $row['id']));?>" title="删除预约" class="btn btn-warning">删除预约</a>
                    <input type="hidden" name="token" value="<?php  echo $_W['token'];?>" />
                    <a class="btn btn-default" href="<?php  echo $this->createWebUrl('member/reservation');?>" style='margin-left:10px;' >返回列表</a>
                </div>
            </div>
         </div>

    </div>   
    
</form>
<?php  } ?>
<script language='javascript'>
    
         function search_members() {
             if( $.trim($('#search-kwd-notice').val())==''){
                 Tip.focus('#search-kwd-notice','请输入关键词');
                 return;
             }
        $("#module-menus-notice").html("正在搜索....")
        $.get('<?php  echo $this->createWebUrl('commission/agent')?>', {
            keyword: $.trim($('#search-kwd-notice').val()),'op':'query',selfid:"<?php  echo $id;?>"
        }, function(dat){
            $('#module-menus-notice').html(dat);
        });
    }
    function select_member(o) {
        $("#agentid").val(o.id);
                  $("#parentagentavatar").show();
                  $("#parentagentavatar").find('img').attr('src',o.avatar);
        $("#parentagent").val( o.nickname+ "/" + o.realname + "/" + o.mobile );
        $("#modal-module-menus-notice .close").click();
    }
        
    </script>
<?php include page("footer-base");?>